const express = require('express')
// 创建路由对象
const router = express.Router()

// 导入笔记处理函数的模块
const notesHandler = require('../router_handler/notes')

// 1. 导入验证表单数据的中间件
const expressJoi = require('@escook/express-joi')

// 导入笔记的验证规则对象
const { req_notes_schema } = require('../schema/notes')


// 添加笔记
router.post('/addnotes', expressJoi(req_notes_schema), notesHandler.addNotes)


// 获取笔记
router.post('/getnotes', notesHandler.getNotes)

// 更新笔记
router.post('/updatenotes', expressJoi(req_notes_schema), notesHandler.updateNotes)

// 删除笔记
router.post('/deletenotes', notesHandler.deleteNotes)


// 将路由对象共享出去
module.exports = router